//
//  XMMacroConfig.h
//  XMKit
//
//  Created by chenming on 2018/5/26.
//  Copyright © 2018年 ChenXiaoMing. All rights reserved.
//

#ifndef XMMacroConfig_h
#define XMMacroConfig_h

/** 屏幕宽度 */
#define kSCREENWIDTH [UIScreen mainScreen].bounds.size.width

#define kSCREENHEIGHT [UIScreen mainScreen].bounds.size.height

#define XMRealValue(value) ((value)/375.0f * [UIScreen mainScreen].bounds.size.width)

#define TabbarHeight ([[UIApplication sharedApplication] statusBarFrame].size.height > 20 ? 83 : 49)
// 适配iPhone x 底栏高度

#define NavigationBarHeight ([[UIApplication sharedApplication] statusBarFrame].size.height > 20 ? 88 : 64)
// 适配iPhone x 导航高度

/** 是否是空对象 */
#define KOBJECT_IS_EMPYT(_object) (_object == nil \
|| [_object isKindOfClass:[NSNull class]] \
|| ([_object respondsToSelector:@selector(length)] && [(NSData *)_object length] == 0) \
|| ([_object respondsToSelector:@selector(count)] && [(NSArray *)_object count] == 0))

#ifdef DEBUG
#define XMLog(...) printf("[%s] %s [第%d行]: %s\n", __TIME__ ,__PRETTY_FUNCTION__ ,__LINE__, [[NSString stringWithFormat:__VA_ARGS__] UTF8String])
#else
#define XMLog(...)
#endif

/** keyWindow */
#define KKEY_WINDOW         [UIApplication sharedApplication].keyWindow

/** delegateWindow */
#define KDELEGATE_WINDOW        [UIApplication sharedApplication].delegate.window

/** 弱引用/强引用 */
#define XMWeakSelf(type)  __weak typeof(type) weak##type = type

#define XMStrongSelf(type)  __strong typeof(type) type = weak##type

static NSString *const kPlayFinishedNotify = @"PlayFinishedNotify";
#endif /* XMMacroConfig_h */
